let id;
window.onload=function (){
    id = getQuery("id")
    cutByItem(1);
    $("jump").innerHTML=`<a href="/add.html?channelId=${id}">-发表话题-</a>`
}


function cutByItem(pageNum){
    axios.get("/post/cutByItem",{
        params: {
            pageNum,
            id,
            title:$("title").value,
            name:$("user").value,
            startDate:$("startDate").value,
            endDate:$("endDate").value
        }
    }).then(resp=>{
        let info = resp.data;
        let  str = "";
        info.records.forEach(n=>{
            str += `<tr>
                        <td><a href="/reply.html?id=${n.id}">${n.title}</a></td>
                        <td>${n.userBean.name}</td>
                        <td>${n.num}</td>
                        <td>${n.date}</td>
                    </tr>`
        });
        $("data").innerHTML=str;

        //页码
        let cutStr = "";
        for(let i=1;i<=info.pages;i++){
            cutStr += `<a style="margin-left: 10px" href="javascript:cutByItem(${i})">${i}</a>`;
        }
        $("cutDiv").innerHTML = cutStr;
    })
}